import 'package:safetymonitor/generated/json/base/json_convert_content.dart';
import 'package:safetymonitor/app/data/entities/home/analysis/get_device_online_status_entity.dart';

GetDeviceOnlineStatusEntity $GetDeviceOnlineStatusEntityFromJson(Map<String, dynamic> json) {
  final GetDeviceOnlineStatusEntity getDeviceOnlineStatusEntity = GetDeviceOnlineStatusEntity();
  final int? companyId = jsonConvert.convert<int>(json['companyId']);
  if (companyId != null) {
    getDeviceOnlineStatusEntity.companyId = companyId;
  }
  final String? companyName = jsonConvert.convert<String>(json['companyName']);
  if (companyName != null) {
    getDeviceOnlineStatusEntity.companyName = companyName;
  }
  final String? safeOnlineQuantity = jsonConvert.convert<String>(json['safeOnlineQuantity']);
  if (safeOnlineQuantity != null) {
    getDeviceOnlineStatusEntity.safeOnlineQuantity = safeOnlineQuantity;
  }
  final String? safeOfflineQuantity = jsonConvert.convert<String>(json['safeOfflineQuantity']);
  if (safeOfflineQuantity != null) {
    getDeviceOnlineStatusEntity.safeOfflineQuantity = safeOfflineQuantity;
  }
  final String? environmentalOnlineQuantity = jsonConvert.convert<String>(json['environmentalOnlineQuantity']);
  if (environmentalOnlineQuantity != null) {
    getDeviceOnlineStatusEntity.environmentalOnlineQuantity = environmentalOnlineQuantity;
  }
  final String? environmentalOfflineQuantity = jsonConvert.convert<String>(json['environmentalOfflineQuantity']);
  if (environmentalOfflineQuantity != null) {
    getDeviceOnlineStatusEntity.environmentalOfflineQuantity = environmentalOfflineQuantity;
  }
  return getDeviceOnlineStatusEntity;
}

Map<String, dynamic> $GetDeviceOnlineStatusEntityToJson(GetDeviceOnlineStatusEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['companyId'] = entity.companyId;
  data['companyName'] = entity.companyName;
  data['safeOnlineQuantity'] = entity.safeOnlineQuantity;
  data['safeOfflineQuantity'] = entity.safeOfflineQuantity;
  data['environmentalOnlineQuantity'] = entity.environmentalOnlineQuantity;
  data['environmentalOfflineQuantity'] = entity.environmentalOfflineQuantity;
  return data;
}

extension GetDeviceOnlineStatusEntityExtension on GetDeviceOnlineStatusEntity {
  GetDeviceOnlineStatusEntity copyWith({
    int? companyId,
    String? companyName,
    String? safeOnlineQuantity,
    String? safeOfflineQuantity,
    String? environmentalOnlineQuantity,
    String? environmentalOfflineQuantity,
  }) {
    return GetDeviceOnlineStatusEntity()
      ..companyId = companyId ?? this.companyId
      ..companyName = companyName ?? this.companyName
      ..safeOnlineQuantity = safeOnlineQuantity ?? this.safeOnlineQuantity
      ..safeOfflineQuantity = safeOfflineQuantity ?? this.safeOfflineQuantity
      ..environmentalOnlineQuantity = environmentalOnlineQuantity ?? this.environmentalOnlineQuantity
      ..environmentalOfflineQuantity = environmentalOfflineQuantity ?? this.environmentalOfflineQuantity;
  }
}